import { admincreateUserData, admingetUser, adminLoginInfo, adminupdateUserdata } from "@/type/user"
import request from "@/utils/request"

//管理员登录
export const adminLogin=(data:adminLoginInfo)=>{
    return request({
        url:'/admin/auth/sign_in',
        method:'post',
        data
    })
}

//管理员查询用户列表
export const admingetUsers=(data:admingetUser)=>{
    return request({
        url:'/admin/users',
        method:'get',
        params:data
    })
}

//管理员查询用户详情
export const admingetUserDetail=(id:string)=>{
    return request({
        url:`/admin/users/${id}`,
        method:'get'
    })
}

//管理员创建用户
export const admincreateUser=(data:admincreateUserData)=>{
    return request({
        url:'/admin/users',
        method:'post',
        data
    })
}

//管理员更新用户
export const adminupdateUser=(id:string,data:adminupdateUserdata)=>{
    return request({
        url:`/admin/users/${id}`,
        method:'put',
        data
    })
}